package com.joysuch.wwyt.app.controller;

import com.joysuch.wwyt.app.service.AppInspectService;
import com.joysuch.wwyt.bp.bean.inspect.BpInspectRecordQueryBean;
import com.joysuch.wwyt.bp.entity.inspect.BpInspectPlan;
import com.joysuch.wwyt.bp.entity.inspect.BpInspectRecord;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * App巡检
 *
 * @Author ZhangDong
 * @Date 2020/6/24 15:11
 */
@RestController
@RequestMapping("/bp/app/inspect")
@Api(tags = "/bp/app/inspect  App巡检")
@CrossOrigin
public class AppInspectController {

    @Autowired
    private AppInspectService appInspectService;

    /**
     * 1.当前用户当天所有分配的计划任务
     * 2.不同时间段同一计划的任务只显示一条，正序
     * 3.多人任务情况，都可以做
     * 4.过期的任务依然可以做，保存记录即可
     */
    @GetMapping("/v2/need")
    @ApiOperation(value = "app 今日待办任务", response = BpInspectPlan.class)
    public ResultBean appNeedDo(Pageable pageable) {
        return appInspectService.appNeedDo(pageable);
    }

    @GetMapping("/v2/page")
    @ApiOperation(value = "app 检查记录列表", response = BpInspectRecord.class)
    public ResultBean page(BpInspectRecordQueryBean bean) {
        return appInspectService.page(bean);
    }

    @GetMapping("/v2/get")
    @ApiOperation(value = "app 巡检-待办跳转巡检任务详情")
    public ResultBean get(Long planId){ return appInspectService.get(planId); }
}
